Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Karma configurations #157

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions karma.conf.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { webkit } from '@playwright/test';
import * as NodePolyfillPlugin from 'node-polyfill-webpack-plugin';
import { DefinePlugin } from 'webpack';

const testFiles = [
'engines/query-sparql-link-traversal-solid/test/QuerySparqlLinkTraversalSolid-solidbench-test.ts',
];

process.env.WEBKIT_HEADLESS_BIN = webkit.executablePath();

// Based on https://github.com/tom-sherman/blog/blob/main/posts/02-running-jest-tests-in-a-browser.md
function defineConfig(config: any): void {
config.set({
basePath: __dirname,
plugins: [
'karma-webpack',
'karma-jasmine',
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-webkit-launcher',
'karma-sourcemap-loader',
'karma-jasmine-html-reporter',
],
frameworks: [ 'jasmine', 'webpack' ],
files: [ './karma.setup.ts', ...testFiles ],
client: {
args: [ '--grep', '/^(?!.*no browser).*$/' ],
},
preprocessors: {
'./karma.setup.ts': [ 'webpack' ],
...Object.fromEntries(testFiles.map(testFile => [ testFile, [ 'webpack', 'sourcemap' ]])),
},
webpack: {
devtool: 'inline-source-map',
mode: 'production',
module: {
rules: [
{
test: /\.ts$/u,
loader: 'ts-loader',
exclude: /node_modules/u,
options: { transpileOnly: true },
},
],
},
plugins: [
new NodePolyfillPlugin({
additionalAliases: [
'process',
],
}),
new DefinePlugin({ 'process.stdout.isTTY': false }),
],
resolve: {
alias: {
fs: false,
module: false,
'jest.unmock': false,
},
extensions: [ '.js', '.ts' ],
},
},
browsers: [
'ChromeHeadless',
'FirefoxHeadless',
'WebkitHeadless',
],
});
};

export default defineConfig;
104 changes: 0 additions & 104 deletions karma.config.js

This file was deleted.

4 changes: 2 additions & 2 deletions karma-setup.js → karma.setup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import expect from 'expect';

Check failure on line 1 in karma.setup.ts

View workflow job for this annotation

GitHub Actions / lint

'expect' should be listed in the project's dependencies. Run 'npm i -S expect' to add it
import jest from 'jest-mock';

Check failure on line 2 in karma.setup.ts

View workflow job for this annotation

GitHub Actions / lint

'jest-mock' should be listed in the project's dependencies. Run 'npm i -S jest-mock' to add it

// Add missing Jest functions
window.test = window.it;
Expand All @@ -9,5 +9,5 @@
}
};
window.test.todo = function() {};
window.jest = jest;
window.expect = expect;
(<any>window).jest = jest;
(<any>window).expect = expect;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"@comunica/packager": "4.0.1",
"@comunica/utils-jest": "4.0.2",
"@comunica/utils-monorepo": "4.0.1",
"@playwright/test": "^1.49.0",
"@pollyjs/adapter-node-http": "^6.0.6",
"@pollyjs/core": "^6.0.6",
"@pollyjs/persister-fs": "^6.0.6",
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"extends": "./tsconfig.json",
"include": [
"engines/**/*.ts",
"packages/**/*.ts"
"packages/**/*.ts",
"karma.conf.ts",
"karma.setup.ts"
],
"exclude": [
"**/node_modules"
Expand Down
26 changes: 26 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8742,6 +8742,13 @@
resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31"
integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==

"@playwright/test@^1.49.0":
version "1.49.0"
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.49.0.tgz#74227385b58317ee076b86b56d0e1e1b25cff01e"
integrity sha512-DMulbwQURa8rNIQrf94+jPJQ4FmOVdpE5ZppRNvWVjvhC+6sOeo28r8MgIpQRYouXRtt/FCCXU7zn20jnHR4Qw==
dependencies:
playwright "1.49.0"

"@pollyjs/adapter-node-http@^6.0.6":
version "6.0.6"
resolved "https://registry.yarnpkg.com/@pollyjs/adapter-node-http/-/adapter-node-http-6.0.6.tgz#7122765604e3dfdd6d68bced8a89c7966d49d710"
Expand Down Expand Up @@ -13217,6 +13224,11 @@ fs.realpath@^1.0.0:
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==

[email protected]:
version "2.3.2"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==

fsevents@^2.3.2, fsevents@~2.3.2:
version "2.3.3"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6"
Expand Down Expand Up @@ -17312,6 +17324,20 @@ pkg-types@^1.0.3, pkg-types@^1.1.1:
mlly "^1.7.0"
pathe "^1.1.2"

[email protected]:
version "1.49.0"
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.49.0.tgz#8e69ffed3f41855b854982f3632f2922c890afcb"
integrity sha512-R+3KKTQF3npy5GTiKH/T+kdhoJfJojjHESR1YEWhYuEKRVfVaxH3+4+GvXE5xyCngCxhxnykk0Vlah9v8fs3jA==

[email protected]:
version "1.49.0"
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.49.0.tgz#df6b9e05423377a99658202844a294a8afb95d0a"
integrity sha512-eKpmys0UFDnfNb3vfsf8Vx2LEOtflgRebl0Im2eQQnYMA4Aqd+Zw8bEOB+7ZKvN76901mRnqdsiOGKxzVTbi7A==
dependencies:
playwright-core "1.49.0"
optionalDependencies:
fsevents "2.3.2"

please-upgrade-node@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz#aeddd3f994c933e4ad98b99d9a556efa0e2fe942"
Expand Down
Loading