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

chore: replace karma with wpt runner in user-interaction #2005

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
75 changes: 27 additions & 48 deletions package-lock.json

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

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,13 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"devDependencies": {
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@typescript-eslint/eslint-plugin": "5.8.1",
"@typescript-eslint/parser": "5.8.1",
"@web/dev-server-esbuild": "^1.0.2",
"@web/dev-server-rollup": "^0.6.1",
"@web/test-runner": "^0.18.1",
"eslint": "8.7.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-prettier": "8.8.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,11 @@
},
"devDependencies": {
"@babel/core": "7.22.17",
"@jsdevtools/coverage-istanbul-loader": "3.0.5",
"@opentelemetry/api": "^1.3.0",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/chai": "^4.3.10",
"@types/mocha": "8.2.3",
"@types/node": "18.6.5",
"@types/sinon": "10.0.18",
"@web/dev-server-esbuild": "^1.0.1",
"@web/dev-server-rollup": "^0.6.1",
"@web/test-runner": "^0.18.0",
"chai": "^4.3.10",
"sinon": "15.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,4 @@
* limitations under the License.
*/

import { nodeResolve as nodeResolveRollup } from '@rollup/plugin-node-resolve';
import commonjsRollup from '@rollup/plugin-commonjs';
import { esbuildPlugin } from '@web/dev-server-esbuild';
import { fromRollup } from '@web/dev-server-rollup';
import { chromeLauncher } from '@web/test-runner';

const nodeResolve = fromRollup(nodeResolveRollup);
const commonjs = fromRollup(commonjsRollup);

export default {
files: ['test/**/*.test.ts'],
nodeResolve: true,
browsers: [chromeLauncher({ launchOptions: { args: ['--no-sandbox'] } })],
plugins: [
esbuildPlugin({ ts: true }),
nodeResolve({ browser: true, preferBuiltins: false }),
commonjs(),
],
};
export { default } from '../../../web-test-runner.base.mjs';
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
https://www.apache.org/licenses/LICENSE-2.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should be reverted. The LICENSE files are meant to be a verbatim copy of https://www.apache.org/licenses/LICENSE-2.0.txt


Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"version:update": "node ../../../scripts/version-update.js",
"compile": "npm run version:update && tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
"prepublishOnly": "npm run compile",
"tdd": "karma start",
"test:browser": "nyc karma start --single-run",
"tdd": "wtr --watch",
"test:browser": "wtr --coverage",
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json"
},
"keywords": [
Expand Down Expand Up @@ -49,34 +49,19 @@
},
"devDependencies": {
"@babel/core": "7.22.17",
"@jsdevtools/coverage-istanbul-loader": "3.0.5",
"@opentelemetry/api": "^1.3.0",
"@opentelemetry/context-zone-peer-dep": "^1.8.0",
"@opentelemetry/instrumentation-xml-http-request": "^0.49.1",
"@opentelemetry/sdk-trace-base": "^1.8.0",
"@types/chai": "^4.3.10",
"@types/jquery": "3.5.20",
"@types/mocha": "7.0.2",
"@types/mocha": "8.2.3",
"@types/node": "18.6.5",
"@types/sinon": "10.0.18",
"@types/webpack-env": "1.16.2",
"babel-loader": "8.2.2",
"karma": "6.3.16",
"karma-chrome-launcher": "^3.1.1",
"karma-coverage-istanbul-reporter": "3.0.3",
"karma-jquery": "0.2.4",
"karma-mocha": "2.0.1",
"karma-spec-reporter": "0.0.36",
"karma-webpack": "4.0.2",
"mocha": "7.2.0",
"nyc": "15.1.0",
"rimraf": "5.0.5",
"@web/test-runner": "^0.18.0",
"chai": "^4.3.10",
"sinon": "15.2.0",
"ts-loader": "8.3.0",
"ts-mocha": "10.0.0",
"typescript": "4.4.4",
"webpack": "4.46.0",
"webpack-cli": "4.7.2",
"webpack-merge": "5.8.0",
"zone.js": "^0.11.4 || ^0.13.0 || ^0.14.0"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
*/

import * as tracing from '@opentelemetry/sdk-trace-base';
import * as assert from 'assert';
// @ts-expect-error: not an export, but we want the prebundled version
import chai from 'chai/chai.js';

const { assert } = chai as typeof import('chai');

export class DummySpanExporter implements tracing.SpanExporter {
export(spans: tracing.ReadableSpan[]) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import { registerInstrumentations } from '@opentelemetry/instrumentation';
import { XMLHttpRequestInstrumentation } from '@opentelemetry/instrumentation-xml-http-request';
import * as tracing from '@opentelemetry/sdk-trace-base';
import { WebTracerProvider } from '@opentelemetry/sdk-trace-web';
import * as assert from 'assert';
// @ts-expect-error: not an export, but we want the prebundled version
import chai from 'chai/chai.js';
import * as sinon from 'sinon';
import { UserInteractionInstrumentation } from '../src';
import { UserInteractionInstrumentationConfig } from '../src/types';
Expand All @@ -35,6 +36,7 @@ import {
getData,
} from './helper.test';

const { assert } = chai as typeof import('chai');
const FILE_URL =
'https://raw.githubusercontent.com/open-telemetry/opentelemetry-js/main/package.json';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import {
import { XMLHttpRequestInstrumentation } from '@opentelemetry/instrumentation-xml-http-request';
import * as tracing from '@opentelemetry/sdk-trace-base';
import { WebTracerProvider } from '@opentelemetry/sdk-trace-web';
import * as assert from 'assert';
// @ts-expect-error: not an export, but we want the prebundled version
import chai from 'chai/chai.js';
import * as sinon from 'sinon';
import 'zone.js';
import { UserInteractionInstrumentation } from '../src';
Expand All @@ -39,6 +40,7 @@ import {
getData,
} from './helper.test';

const { assert } = chai as typeof import('chai');
const FILE_URL =
'https://raw.githubusercontent.com/open-telemetry/opentelemetry-js/main/package.json';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*!
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -13,8 +13,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const testsContext = require.context('.', true, /test$/);
testsContext.keys().forEach(testsContext);

const srcContext = require.context('.', true, /src$/);
srcContext.keys().forEach(srcContext);
export { default } from '../../../web-test-runner.base.mjs';
35 changes: 35 additions & 0 deletions web-test-runner.base.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*!
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { nodeResolve as nodeResolveRollup } from '@rollup/plugin-node-resolve';
import commonjsRollup from '@rollup/plugin-commonjs';
import { esbuildPlugin } from '@web/dev-server-esbuild';
import { fromRollup } from '@web/dev-server-rollup';
import { chromeLauncher } from '@web/test-runner';

const nodeResolve = fromRollup(nodeResolveRollup);
const commonjs = fromRollup(commonjsRollup);

export default {
files: ['test/**/*.test.ts'],
nodeResolve: true,
browsers: [chromeLauncher({ launchOptions: { args: ['--no-sandbox'] } })],
plugins: [
esbuildPlugin({ ts: true }),
nodeResolve({ browser: true, preferBuiltins: false }),
commonjs(),
],
};
Loading