Skip to content

Commit

Permalink
updated: Coverage generation and unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GianlucaGuarini committed May 21, 2023
1 parent 113f7a7 commit 56e806d
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ GENERATED_FILES = riot.js riot+compiler.js
test: lint test-karma test-typing

test-karma:
@ $(KARMA) start test/karma.conf.js
@ $(KARMA) start test/karma.conf.cjs

lint:
# check if the code looks pretty
Expand Down
41 changes: 35 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,18 @@
"sideEffects": false,
"types": "./riot.d.ts",
"devDependencies": {
"@riotjs/compiler": "^6.4.2",
"@riotjs/dom-bindings": "^6.0.7",
"@riotjs/prettier-config": "^1.0.1",
"@riotjs/util": "^2.2.1",
"@rollup/plugin-commonjs": "^25.0.0",
"@rollup/plugin-node-resolve": "^15.0.2",
"bianco.attr": "^1.1.1",
"bianco.query": "^1.1.4",
"chai": "^4.3.7",
"core-js": "^3.30.2",
"cumpa": "^2.0.1",
"curri": "^2.0.3",
"eslint": "^8.41.0",
"eslint-config-riot": "^4.0.0",
"jsdom": "22.0.0",
Expand All @@ -77,17 +84,11 @@
"karma-sauce-launcher": "^4.3.6",
"mocha": "^10.2.0",
"rollup": "^3.22.1",
"rollup-plugin-istanbul": "^4.0.0",
"rollup-plugin-riot": "^6.0.0",
"sinon": "^15.1.0",
"sinon-chai": "^3.7.0",
"terser": "^5.17.4",
"typescript": "^5.0.4",
"@riotjs/compiler": "^6.4.2",
"@riotjs/dom-bindings": "^6.0.7",
"@riotjs/util": "^2.2.1",
"bianco.attr": "^1.1.1",
"bianco.query": "^1.1.4",
"cumpa": "^2.0.1",
"curri": "^2.0.3"
"typescript": "^5.0.4"
}
}
File renamed without changes.
16 changes: 10 additions & 6 deletions test/karma.conf.js → test/karma.conf.cjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
const saucelabsBrowsers = require('./saucelabs-browsers').browsers,
const saucelabsBrowsers = require('./saucelabs-browsers.cjs').browsers,
riotRollup = require('rollup-plugin-riot'),
istanbul = require('rollup-plugin-istanbul'),
isSaucelabs = process.env.SAUCELABS,
isTravis = !!process.env.TRAVIS_BUILD_NUMBER,
TEST_FILES = './specs/**/*.spec.js',
browsers = isSaucelabs
? Object.keys(saucelabsBrowsers)
: ['ChromeHeadlessNoSandbox'],
rollupConfig = require('../rollup.config')

// set the babel env in order to enable the babel istanbul plugin
process.env.BABEL_ENV = 'test'
rollupConfig = require('../rollup.config.cjs')

module.exports = function (conf) {
conf.set({
Expand Down Expand Up @@ -59,7 +57,13 @@ module.exports = function (conf) {

rollupPreprocessor: {
...rollupConfig,
plugins: [riotRollup(), ...rollupConfig.plugins],
plugins: [
riotRollup(),
istanbul({
exclude: ['./test/**/*', './node_modules/**/*'],
}),
...rollupConfig.plugins,
],
onwarn: () => {},
external: ['chai', 'sinon'],
output: {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/specs/components-registration.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as riot from '../../src/riot'
import { fireEvent, normalizeInnerHTML } from '../utils'
import { fireEvent, normalizeInnerHTML } from '../utils.cjs'

import GlobalComponents from '../components/global-components.riot'
import NestedAliasedImportsComponent from '../components/nested-aliased-imports.riot'
Expand Down
2 changes: 1 addition & 1 deletion test/specs/slots.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as riot from '../../src/riot'
import { fireEvent, normalizeInnerHTML } from '../utils'
import { fireEvent, normalizeInnerHTML } from '../utils.cjs'

import ConditionalSlotParent from '../components/conditional-slot-parent.riot'
import LoopWithSlots from '../components/loop-with-slots.riot'
Expand Down
File renamed without changes.

0 comments on commit 56e806d

Please sign in to comment.