Skip to content

Commit

Permalink
chore: Replace karmajs with wdio
Browse files Browse the repository at this point in the history
  • Loading branch information
GianlucaGuarini committed Feb 23, 2024
1 parent 164ac0a commit 8ba96f1
Show file tree
Hide file tree
Showing 7 changed files with 16,242 additions and 7,013 deletions.
2 changes: 1 addition & 1 deletion build/rollup.browser.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import alias from '@rollup/plugin-alias'
import builtins from 'rollup-plugin-node-builtins'
import builtins from 'rollup-plugin-polyfill-node'
import commonjs from '@rollup/plugin-commonjs'
import defaultConfig from './rollup.config.js'
import json from '@rollup/plugin-json'
Expand Down
22,872 changes: 15,881 additions & 6,991 deletions package-lock.json

Large diffs are not rendered by default.

41 changes: 22 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"build": "rollup -c build/rollup.node.config.js && rollup -c build/rollup.browser.config.js && rollup -c build/rollup.essential.config.js",
"postest": "npm run cov-html",
"test-types": "tsc -p test",
"test-runtime": "karma start test/karma.conf.cjs",
"test-runtime": "start-server-and-test serve 3000 wdio run ./wdio.conf.js",
"test-commonjs": "c8 mocha 'test/**/*.spec.cjs'",
"test": "c8 mocha 'test/**/*.spec.js' && npm run test-types",
"debug": "mocha --inspect --inspect-brk 'test/**/*.spec.js'",
Expand All @@ -49,33 +49,36 @@
"compiler"
],
"devDependencies": {
"@babel/core": "^7.23.6",
"@babel/preset-env": "^7.23.6",
"@riotjs/dom-bindings": "^9.0.3",
"@babel/core": "^7.23.9",
"@babel/preset-env": "^7.23.9",
"@riotjs/dom-bindings": "^9.0.4",
"@riotjs/prettier-config": "^1.1.0",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"acorn": "^8.11.2",
"c8": "^8.0.1",
"chai": "^4.3.10",
"eslint": "^8.55.0",
"@wdio/cli": "^8.32.3",
"@wdio/local-runner": "^8.32.3",
"@wdio/mocha-framework": "^8.32.3",
"@wdio/spec-reporter": "^8.32.2",
"acorn": "^8.11.3",
"c8": "^9.1.0",
"chai": "^5.1.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-riot": "^4.1.1",
"eslint-config-riot": "^4.1.2",
"eslint-plugin-fp": "^2.3.0",
"esm": "^3.2.25",
"karma": "^6.4.2",
"karma-chrome-launcher": "^3.2.0",
"karma-mocha": "^2.0.1",
"mocha": "^10.2.0",
"prettier": "^3.1.1",
"mocha": "^10.3.0",
"prettier": "^3.2.5",
"pug": "^3.0.2",
"rollup": "^4.9.0",
"rollup": "^4.12.0",
"rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-visualizer": "^5.11.0",
"sass": "^1.69.5",
"rollup-plugin-visualizer": "^5.12.0",
"sass": "^1.71.1",
"serve": "^14.2.1",
"shelljs": "^0.8.5",
"start-server-and-test": "^2.0.3",
"typescript": "^5.3.3"
},
"author": "Gianluca Guarini <gianluca.guarini@gmail.com> (http://gianlucaguarini.com)",
Expand All @@ -85,14 +88,14 @@
},
"homepage": "https://github.com/riot/compiler#readme",
"dependencies": {
"@babel/parser": "^7.23.6",
"@babel/parser": "^7.23.9",
"@riotjs/parser": "^5.0.1",
"@riotjs/util": "2.2.4",
"cssesc": "^3.0.0",
"cumpa": "^2.0.1",
"curri": "^2.0.3",
"dom-nodes": "^1.1.3",
"globals": "^13.24.0",
"globals": "^14.0.0",
"recast": "^0.23.4",
"source-map": "^0.7.4"
}
Expand Down
3 changes: 1 addition & 2 deletions test/browser.runtime.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* global chai, compiler */

Check failure on line 1 in test/browser.runtime.js

View workflow job for this annotation

GitHub Actions / build (18.x)

'chai' is defined but never used

Check failure on line 1 in test/browser.runtime.js

View workflow job for this annotation

GitHub Actions / build (20.x)

'chai' is defined but never used

const { expect } = chai
import { expect } from '../node_modules/chai/chai.js'

describe('Browser runtime compilation', () => {
it('it compiles tags in the browser', () => {
Expand Down
29 changes: 29 additions & 0 deletions test/e2e.runtime.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
/>
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>E2E Tests</title>
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
</head>
<body>
<div id="mocha"></div>
<script src="../node_modules/mocha/mocha.js"></script>
<script src="../dist/compiler.essential.cjs"></script>
<script type="module">
mocha.setup('bdd')
</script>
<script type="module" src="./browser.runtime.js"></script>
<script>
mocha.run((failures) => {
// store the failure amount into this global variable that can be accessed from our e2e environment
window.testFailures = failures
})
</script>
<script></script>
</body>
</html>
14 changes: 14 additions & 0 deletions test/test.e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { browser, expect } from '@wdio/globals'

describe('Run the mocha tests', function () {
it('All the mocha tests passed', async () => {
await browser.url('http://localhost:3000/test/e2e.runtime.html')
await browser.waitUntil(async () =>
browser.execute(() => typeof window.testFailures === 'number'),
)
const testFailures = await browser.execute(() => window.testFailures)

expect(testFailures).toBe(0)
expect(true).toBe(true)
})
})
Loading

0 comments on commit 8ba96f1

Please sign in to comment.