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

infra: reconfigure jest #402

Draft
wants to merge 6 commits into
base: main
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
5 changes: 5 additions & 0 deletions .changeset/unlucky-suits-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
Copy link
Contributor

Choose a reason for hiding this comment

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

We should remove this .changeset.

"generator-single-spa": major
---

remove "husky" from create-single-spa templates
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ jobs:
- run: git checkout main && git checkout $GITHUB_SHA
- run: pnpm install --frozen-lockfile
- run: pnpm changeset status
- run: pnpm test --recursive
- run: pnpm test
- run: pnpm run --recursive lint
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"jest.jestCommandLine": "pnpm run test"
}
8 changes: 5 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
module.exports = {
testEnvironment: "node",
// Fun times waiting on pnpm installs inside of CI
testTimeout: 120000,
testRegex: "tests\\/e2e\\/.+test.js",
testPathIgnorePatterns: ["<rootDir>/tests/fixtures/"],
watchPathIgnorePatterns: ["<rootDir>/tests/fixtures/"],
globalSetup: "<rootDir>/tests/create-fixtures.js",
projects: [
"<rootDir>/packages/*/jest.config.js",
"<rootDir>/tests/jest.config.js",
],
};
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.1",
"@types/jest": "^27.0.1",
"cross-env": "^7.0.3",
"husky": "^7.0.2",
"jest": "^27.5.1",
"jest-cli": "^27.5.1",
Expand All @@ -15,9 +16,8 @@
"rimraf": "^3.0.2"
},
"scripts": {
"clean-tests": "rimraf tests/fixtures && pnpm install",
"test": "pnpm run clean-tests && pnpm run test:e2e",
"test:e2e": "jest",
"test:all": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --all",
"test": "rimraf tests/fixtures && pnpm run test:all",
"format": "prettier . --write",
"prepare": "husky install"
},
Expand Down
5 changes: 5 additions & 0 deletions packages/generator-single-spa/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
testEnvironment: "node",
// Tests in the "src" folder are template tests which should not be run as part of the generator tests
testPathIgnorePatterns: ["<rootDir>/src/"],
};
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"rollup-plugin-svelte": "^7.1.0",
"rollup-plugin-terser": "^7.0.2",
"svelte": "^3.42.3",
"svelte-jester": "^2.0.0"
"svelte-jester": "^2.3.2"
},
"dependencies": {
"single-spa-svelte": "^2.1.1",
Expand Down
3 changes: 3 additions & 0 deletions packages/single-spa-web-server-utils/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@babel/preset-env"]
}
5 changes: 5 additions & 0 deletions packages/single-spa-web-server-utils/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
/** @type {import('@jest/types').Config.ProjectConfig} */

const config = {
moduleNameMapper: {
"node-fetch": "<rootDir>/__mocks__/node-fetch.js",
"import-map-overrides": "<rootDir>/__mocks__/import-map-overrides.js",
},
transformIgnorePatterns: [
"/node_modules/(?!(node-fetch|lodash|import-map-overrides)/)",
],
transform: {},
clearMocks: true,
};

Expand Down
2 changes: 2 additions & 0 deletions packages/single-spa-web-server-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
"node-fetch": "^2.7.0"
},
"devDependencies": {
"@babel/preset-env": "^7.23.3",
"@jest/globals": "^27.4.6",
"@jest/types": "^27.4.2",
"babel-jest": "^27.5.1",
"cross-env": "^7.0.3",
"jest": "^27.4.7",
"jest-cli": "^27.4.7"
Expand Down
2 changes: 1 addition & 1 deletion packages/single-spa-welcome/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
rootDir: "src",
testEnvironment: "jsdom",
transform: {
"^.+\\.(j|t)sx?$": "babel-jest",
"\\.[jt]sx?$": ["babel-jest", { cwd: __dirname }],
},
moduleNameMapper: {
"\\.(css)$": "identity-obj-proxy",
Expand Down
Loading
Loading