Restructure test files (#10415)

This commit is contained in:
fisker Cheung authored and GitHub committed 2021-04-25 20:01:56 +08:00
1 parent 5d1ba827c6
commit ece93681f1
6683 files changed
+61 -54

No files matched your search

+3 -3
View File
@@ -1,6 +1,7 @@
!/*.js
/tests/**/*.js
!/tests/**/jsfmt.spec.js
/tests/format/**/*.js
/tests/integration/cli/
!/tests/format/**/jsfmt.spec.js
!/**/.eslintrc.js
/test*.js
/scripts/release/node_modules
@@ -10,4 +11,3 @@
/website/build/
/website/static/playground.js
/website/static/lib/
/tests_integration/cli/
+3 -1
View File
@@ -91,7 +91,9 @@ overrides:
parserOptions:
sourceType: module
- files:
- "{tests,tests_config,tests_integration}/**/*.js"
- "tests/format/**/jsfmt.spec.js"
- "tests/config/**/*.js"
- "tests/integration/**/*.js"
env:
jest: true
plugins:
+1 -1
View File
@@ -77,7 +77,7 @@ jobs:
# #8073 test
- name: Run Tests (PRETTIER_FALLBACK_RESOLVE)
run: yarn test "tests_integration/__tests__/(config|plugin)"
run: yarn test "tests/integration/__tests__/(config|plugin)"
env:
PRETTIER_FALLBACK_RESOLVE: true
+1 -1
View File
@@ -144,7 +144,7 @@ jobs:
# #8073 test
- name: Run Tests (PRETTIER_FALLBACK_RESOLVE)
run: yarn test "tests_integration/__tests__/(config|plugin)"
run: yarn test "tests/integration/__tests__/(config|plugin)"
env:
NODE_ENV: production
PRETTIER_FALLBACK_RESOLVE: true
+3 -3
View File
@@ -3,9 +3,9 @@ dist/
coverage/
/tests/**/*.*
!/tests/**/jsfmt.spec.js
/tests_integration/cli/
/tests_integration/plugins/
/tests_integration/custom-parsers/
/tests/integration/cli/
/tests/integration/plugins/
/tests/integration/custom-parsers/
/website/build/
/website/static/lib/
/website/static/playground.js
+1 -1
View File
@@ -51,7 +51,7 @@ Parameters:
- **`parsers`**: A list of parser names. The tests verify that the parsers in this list produce the same output. If the list includes `typescript`, then `babel-ts` is included implicitly. If the list includes `babel`, and the current directory is inside `tests/js`, then `espree` and `meriyah` are included implicitly.
- **`options`**: In addition to Prettier's formatting option, can contain the `errors` property to specify that it's expected that the formatting shouldn't be successful and an error should be thrown for all (`errors: true`) or some combinations of input entries and parsers.
The implementation of `run_spec` can be found in [`tests_config/run_spec.js`](tests_config/run_spec.js).
The implementation of `run_spec` can be found in [`tests/config/format-test.js`](tests/config/format-test.js).
`tests/flow-repo/` contains the Flow test suite and is not supposed to be edited by hand. To update it, clone the Flow repo next to the Prettier repo and run: `node scripts/sync-flow-tests.js ../flow/tests/`.
+5 -5
View File
@@ -20,7 +20,7 @@ process.env.PRETTIER_DIR = PRETTIER_DIR;
const testPathIgnorePatterns = [];
let transform = {};
if (TEST_STANDALONE) {
testPathIgnorePatterns.push("<rootDir>/tests_integration/");
testPathIgnorePatterns.push("<rootDir>/tests/integration/");
}
if (isProduction) {
// `esm` bundles need transform
@@ -48,12 +48,12 @@ if (isProduction) {
} else {
// Only test bundles for production
testPathIgnorePatterns.push(
"<rootDir>/tests_integration/__tests__/bundle.js"
"<rootDir>/tests/integration/__tests__/bundle.js"
);
}
module.exports = {
setupFiles: ["<rootDir>/tests_config/setup.js"],
setupFiles: ["<rootDir>/tests/config/setup.js"],
snapshotSerializers: [
"jest-snapshot-serializer-raw",
"jest-snapshot-serializer-ansi",
@@ -68,8 +68,8 @@ module.exports = {
],
coverageReporters: ["text", "lcov"],
moduleNameMapper: {
"prettier-local": "<rootDir>/tests_config/require_prettier.js",
"prettier-standalone": "<rootDir>/tests_config/require_standalone.js",
"prettier-local": "<rootDir>/tests/config/require-prettier.js",
"prettier-standalone": "<rootDir>/tests/config/require-standalone.js",
},
modulePathIgnorePatterns: ["<rootDir>/dist", "<rootDir>/website/static/lib"],
testEnvironment: "node",
+1 -1
View File
@@ -140,7 +140,7 @@
"test:dev-package": "cross-env INSTALL_PACKAGE=1 jest",
"test:dist": "cross-env NODE_ENV=production jest",
"test:dist-standalone": "cross-env NODE_ENV=production TEST_STANDALONE=1 jest",
"test:integration": "jest tests_integration",
"test:integration": "jest tests/integration",
"perf:repeat": "yarn && yarn build && cross-env NODE_ENV=production node ./dist/bin-prettier.js --debug-repeat ${PERF_REPEAT:-1000} --loglevel debug ${PERF_FILE:-./index.js} > /dev/null",
"perf:repeat-inspect": "yarn && yarn build && cross-env NODE_ENV=production node --inspect-brk ./dist/bin-prettier.js --debug-repeat ${PERF_REPEAT:-1000} --loglevel debug ${PERF_FILE:-./index.js} > /dev/null",
"perf:benchmark": "yarn && yarn build && cross-env NODE_ENV=production node ./dist/bin-prettier.js --debug-benchmark --loglevel debug ${PERF_FILE:-./index.js} > /dev/null",
@@ -43,7 +43,7 @@ const unstableTests = new Map(
const [file, isUnstable = () => true] = Array.isArray(fixture)
? fixture
: [fixture];
return [path.join(__dirname, "../tests/", file), isUnstable];
return [path.join(__dirname, "../format/", file), isUnstable];
})
);
@@ -53,7 +53,7 @@ const espreeDisabledTests = new Set(
[
// These tests only work for `babel`
"comments-closure-typecast",
].map((directory) => path.join(__dirname, "../tests/js", directory))
].map((directory) => path.join(__dirname, "../format/js", directory))
);
const meriyahDisabledTests = espreeDisabledTests;
@@ -94,7 +94,7 @@ const shouldThrowOnFormat = (filename, options) => {
const isTestDirectory = (dirname, name) =>
(dirname + path.sep).startsWith(
path.join(__dirname, "../tests", name) + path.sep
path.join(__dirname, "../format", name) + path.sep
);
function runSpec(fixtures, parsers, options) {
File renamed without changes.
File renamed without changes.
@@ -2,6 +2,6 @@
Object.defineProperty(global, "run_spec", {
get() {
return require("./run_spec.js");
return require("./format-test");
},
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 6683 files, more files were not shown because too many files have changed in this diff. Show more