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

Fix standalone test #2211

Merged
merged 3 commits into from
Aug 16, 2023
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
4 changes: 2 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
node-version: [14.x, 16.x, 18.x, 20.x]

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: yarn install, build, and test
Expand Down
52 changes: 25 additions & 27 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"use strict";

const ENABLE_COVERAGE = !!process.env.CI;
const RUN_STANDALONE_TESTS = Boolean(process.env.RUN_STANDALONE_TESTS);

module.exports = {
collectCoverage: ENABLE_COVERAGE,
Expand All @@ -10,34 +11,31 @@ module.exports = {
"!<rootDir>/tests_config/",
],
projects: [
{
displayName: "test-node",
setupFiles: ["<rootDir>/tests_config/run_spec.js"],
testRegex: "jsfmt\\.spec\\.js$|__tests__/.*\\.js$",
snapshotSerializers: ["jest-snapshot-serializer-raw"],
testEnvironment: "node",
globals: {
STANDALONE: false,
},
runner: "jest-light-runner",
transform: {},
},
...(/^true$/i.test(process.env.RUN_STANDALONE_TESTS)
? [
{
displayName: "test-standalone",
setupFiles: ["<rootDir>/tests_config/run_spec.js"],
testRegex: "jsfmt\\.spec\\.js$|__tests__/.*\\.js$",
snapshotSerializers: ["jest-snapshot-serializer-raw"],
testEnvironment: "jsdom",
globals: {
STANDALONE: true,
},
runner: "jest-light-runner",
transform: {},
RUN_STANDALONE_TESTS
? {
displayName: "test-standalone",
setupFiles: ["<rootDir>/tests_config/run_spec.js"],
testRegex: "jsfmt\\.spec\\.js$|__tests__/.*\\.js$",
snapshotSerializers: ["jest-snapshot-serializer-raw"],
testEnvironment: "jsdom",
globals: {
STANDALONE: true,
},
runner: "jest-light-runner",
transform: {},
}
: {
displayName: "test-node",
setupFiles: ["<rootDir>/tests_config/run_spec.js"],
testRegex: "jsfmt\\.spec\\.js$|__tests__/.*\\.js$",
snapshotSerializers: ["jest-snapshot-serializer-raw"],
testEnvironment: "node",
globals: {
STANDALONE: false,
},
]
: []),
runner: "jest-light-runner",
transform: {},
},
{
runner: "jest-runner-eslint",
displayName: "lint",
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,16 @@
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-replace": "^2.1.0",
"rollup-plugin-terser": "^7.0.2",
"strip-ansi": "^6.0.0",
"yarpm": "^1.1.1"
"strip-ansi": "^6.0.0"
},
"peerDependencies": {
"prettier": "^3.0.0"
},
"scripts": {
"test": "jest",
"prepublishOnly": "yarpm run build-standalone && cross-env RUN_STANDALONE_TESTS=true yarpm test",
"test": "yarn test:node && yarn test:standalone",
"test:node": "jest",
"test:standalone": "yarn run build-standalone && cross-env RUN_STANDALONE_TESTS=true yarn jest",
"prepublishOnly": "yarn test",
"prettier": "prettier --plugin=src/index.js --parser=php",
"build-standalone": "rollup -c build/rollup.config.js",
"debug": "node --inspect-brk node_modules/.bin/jest --runInBand"
Expand Down
13 changes: 0 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2450,11 +2450,6 @@ combined-stream@^1.0.8:
dependencies:
delayed-stream "~1.0.0"

command-exists@^1.2.9:
version "1.2.9"
resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.9.tgz#c50725af3808c8ab0260fd60b01fbfa25b954f69"
integrity sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==

commander@^2.20.0:
version "2.20.3"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
Expand Down Expand Up @@ -5979,14 +5974,6 @@ yargs@^17.3.1:
y18n "^5.0.5"
yargs-parser "^21.0.0"

yarpm@^1.1.1:
version "1.2.0"
resolved "https://registry.yarnpkg.com/yarpm/-/yarpm-1.2.0.tgz#5baaf5589f6237426cf76f812296dcf9b4254f55"
integrity sha512-gxN4Ali09uey8EpLfbYG+bTXf1hF6TA5oAXFPpKi5Nt5aztXU9AIEksXE0lpuvC50vL4De/KIeP8JXgYOZ8KbQ==
dependencies:
command-exists "^1.2.9"
cross-spawn "^7.0.3"

yocto-queue@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
Expand Down
Loading