Skip to content

chore(dev): Update jest and friends #4897

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

Merged
merged 6 commits into from
Apr 11, 2022
Merged
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
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@ jobs:
uses: actions/checkout@v2
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: '16'
- name: Check dependency cache
uses: actions/cache@v2
with:
Expand Down
1 change: 0 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module.exports = {
},
coverageDirectory: '<rootDir>/coverage',
moduleFileExtensions: ['js', 'ts', 'tsx'],
testEnvironment: 'node',
testMatch: ['<rootDir>/**/*.test.ts', '<rootDir>/**/*.test.tsx'],
globals: {
'ts-jest': {
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,17 @@
"@strictsoftware/typedoc-plugin-monorepo": "^0.3.1",
"@types/chai": "^4.1.3",
"@types/jest": "^24.0.11",
"@types/jsdom": "^16.2.3",
"@types/mocha": "^5.2.0",
"@types/node": "~10.17.0",
"@types/sinon": "^7.0.11",
"chai": "^4.1.2",
"codecov": "^3.6.5",
"deepmerge": "^4.2.2",
"eslint": "7.32.0",
"jest": "^24.9.0",
"jest": "^27.5.1",
"jest-environment-node": "^27.5.1",
"jsdom": "^19.0.0",
"karma-browserstack-launcher": "^1.5.1",
"karma-firefox-launcher": "^1.1.0",
"lerna": "3.13.4",
Expand All @@ -85,15 +88,14 @@
"rollup-plugin-typescript2": "^0.31.2",
"sinon": "^7.3.2",
"size-limit": "^4.5.5",
"ts-jest": "^24.3.0",
"ts-jest": "^27.1.4",
"ts-node": "^8.10.2",
"tslib": "^2.3.1",
"typedoc": "^0.18.0",
"typescript": "3.8.3"
},
"resolutions": {
"**/agent-base": "5",
"**/jest-environment-node": "24"
"**/agent-base": "5"
},
"version": "0.0.0",
"dependencies": {}
Expand Down
1 change: 0 additions & 1 deletion packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"btoa": "^1.2.1",
"chai": "^4.1.2",
"chokidar": "^3.0.2",
"jsdom": "^15.0.0",
"karma": "^6.3.16",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^2.2.0",
Expand Down
1 change: 0 additions & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"eslint-plugin-react-hooks": "^4.0.8",
"history-4": "npm:[email protected]",
"history-5": "npm:[email protected]",
"jsdom": "^16.2.2",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-router-3": "npm:[email protected]",
Expand Down
4 changes: 1 addition & 3 deletions packages/tracing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
},
"devDependencies": {
"@sentry/browser": "7.0.0-alpha.0",
"@types/express": "^4.17.1",
"@types/jsdom": "^16.2.3",
"jsdom": "^16.2.2"
"@types/express": "^4.17.1"
},
"scripts": {
"build": "run-p build:cjs build:esm build:types build:bundle && ts-node ../../scripts/prepack.ts #necessary for integration tests",
Expand Down
3 changes: 1 addition & 2 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
"tslib": "^1.9.3"
},
"devDependencies": {
"chai": "^4.1.2",
"jsdom": "^16.2.2"
"chai": "^4.1.2"
},
"scripts": {
"build": "run-p build:cjs build:esm build:types",
Expand Down
3 changes: 0 additions & 3 deletions packages/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
"peerDependencies": {
"vue": "2.x || 3.x"
},
"devDependencies": {
"jsdom": "^16.2.2"
},
"scripts": {
"build": "run-p build:cjs build:esm build:types",
"build:bundle": "rollup --config",
Expand Down
69 changes: 48 additions & 21 deletions scripts/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,55 @@ function run(cmd: string, cwd: string = '') {

const nodeMajorVersion = parseInt(process.version.split('.')[0].replace('v', ''), 10);

if (nodeMajorVersion <= 8) {
// install legacy versions of packages whose current versions don't support node 8
// Ember tests require dependency changes for each set of tests, making them quite slow. To compensate for this, in CI
// we run them in a separate, parallel job.
let ignorePackages = ['@sentry/ember'];

// install legacy versions of third-party packages whose current versions don't support node 8 or 10, and skip testing
// our own packages which don't support node 8 for various syntax or dependency reasons
if (nodeMajorVersion <= 10) {
let legacyDependencies;

if (nodeMajorVersion === 8) {
legacyDependencies = [
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
];

ignorePackages = [
...ignorePackages,
'@sentry-internal/eslint-plugin-sdk',
'@sentry/react',
'@sentry/wasm',
'@sentry/gatsby',
'@sentry/serverless',
'@sentry/nextjs',
];

// This is a hack, to deal the fact that the browser-based tests fail under Node 8, because of a conflict buried
// somewhere in the interaction between our current overall set of dependencies and the older versions of a small
// subset we're about to install below. Since they're browser-based, these tests are never going to be running in a
// node 8 environment in any case, so it's fine to skip them here. (In the long run, we should only run such tests
// against a single version of node, but in the short run, this at least allows us to not be blocked by the
// failures.)
run('rm -rf packages/tracing/test/browser');
}
// Node 10
else {
legacyDependencies = ['[email protected]'];
}

const legacyDepStr = legacyDependencies.join(' ');

// ignoring engines and scripts lets us get away with having incompatible things installed for packages we're not testing
run('yarn add --dev --ignore-engines --ignore-scripts [email protected]', 'packages/tracing');
run('yarn add --dev --ignore-engines --ignore-scripts [email protected]', 'packages/utils');

// ember tests happen separately, and the rest fail on node 8 for various syntax or dependency reasons
const ignore = [
'@sentry/ember',
'@sentry-internal/eslint-plugin-sdk',
'@sentry/react',
'@sentry/wasm',
'@sentry/gatsby',
'@sentry/serverless',
'@sentry/nextjs',
]
.map(dep => `--ignore="${dep}"`)
.join(' ');

run(`yarn test ${ignore}`);
} else {
run('yarn test --ignore="@sentry/ember"');
run(`yarn add --dev --ignore-engines --ignore-scripts --ignore-workspace-root-check ${legacyDepStr}`);
}

const ignoreFlags = ignorePackages.map(dep => `--ignore="${dep}"`).join(' ');

run(`yarn test ${ignoreFlags}`);

process.exit(0);
Loading