Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj committed May 22, 2023
1 parent 789f253 commit 73cf952
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ const path = require('path')

const generateManifest = (enabledTests, disabledTests) => `
// Tests that are currently enabled with Turbopack in CI.
// Add new test when Turbopack updates to fix / implement a feature.
// This list is not actively used, more of high level pictures of what tests are enabled.
const enabledTests = ${enabledTests}
// Tests that are currently disabled with Turbopack in CI.
// Any tests not listed in here are assumed to be enabled.
const disabledTests = ${disabledTests}
module.exports = {
Expand All @@ -30,7 +31,7 @@ const main = async () => {
enabledTests = manifest.enabledTests
disabledTests = manifest.disabledTests
} else {
throw new Error('a')
throw new Error('Manifest should exists')
}

// Collect all test files
Expand Down
6 changes: 5 additions & 1 deletion packages/next-swc/crates/next-dev-tests/tests-manifest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Tests that are currently enabled with Turbopack in CI.
// Add new test when Turbopack updates to fix / implement a feature.
// This list is not actively used, more of high level pictures of what tests are enabled.
const enabledTests = [
'test/development/acceptance-app/dynamic-error.test.ts',
'test/development/basic/legacy-decorators.test.ts',
Expand All @@ -9,6 +9,7 @@ const enabledTests = [
]

// Tests that are currently disabled with Turbopack in CI.
// Any tests not listed in here are assumed to be enabled.
const disabledTests = [
'test/development/acceptance-app/app-hmr-changes.test.ts',
'test/development/acceptance-app/component-stack.test.ts',
Expand Down Expand Up @@ -76,6 +77,7 @@ const disabledTests = [
'test/e2e/404-page-router/index.test.ts',
'test/e2e/app-dir-legacy-edge-runtime-config/index.test.ts',
'test/e2e/app-dir/_allow-underscored-root-directory/_allow-underscored-root-directory.test.ts',
'test/e2e/app-dir/actions/app-action-export.test.ts',
'test/e2e/app-dir/actions/app-action.test.ts',
'test/e2e/app-dir/app-a11y/index.test.ts',
'test/e2e/app-dir/app-alias/app-alias.test.ts',
Expand Down Expand Up @@ -108,6 +110,7 @@ const disabledTests = [
'test/e2e/app-dir/dynamic-href/dynamic-href.test.ts',
'test/e2e/app-dir/dynamic/dynamic.test.ts',
'test/e2e/app-dir/edge-runtime-node-compatibility/edge-runtime-node-compatibility.test.ts',
'test/e2e/app-dir/error-boundary-and-not-found-linking/error-boundary-and-not-found-linking.test.ts',
'test/e2e/app-dir/front-redirect-issue/front-redirect-issue.test.ts',
'test/e2e/app-dir/global-error/global-error.test.ts',
'test/e2e/app-dir/hooks/hooks.test.ts',
Expand Down Expand Up @@ -672,6 +675,7 @@ const disabledTests = [
'test/unit/esm-interpolate/esm-interpolate.test.tsx',
'test/unit/find-config.test.ts',
'test/unit/find-page-file.test.ts',
'test/unit/get-module-build-info.test.ts',
'test/unit/get-node-options-without-inspect.test.ts',
'test/unit/get-page-static-infos.test.ts',
'test/unit/get-project-dir.test.ts',
Expand Down
20 changes: 14 additions & 6 deletions run-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ const { createNextInstall } = require('./test/lib/create-next-install')
const glob = promisify(_glob)
const exec = promisify(execOrig)

// Try to read an external array-based json to filter tests to be executed.
// Try to read an external array-based json to filter tests to be allowed / or disallowed.
// If process.argv contains a test to be executed, this'll append it to the list.
const externalTestsFilterLists = process.env.NEXT_EXTERNAL_TESTS_FILTERS
? require(process.env.NEXT_EXTERNAL_TESTS_FILTERS).enabledTests
: []
? require(process.env.NEXT_EXTERNAL_TESTS_FILTERS)
: { enabledTests: [], disabledTests: [] }
const timings = []
const DEFAULT_NUM_RETRIES = os.platform() === 'win32' ? 2 : 1
const DEFAULT_CONCURRENCY = 2
Expand Down Expand Up @@ -143,9 +143,7 @@ async function main() {

console.log('Running tests with concurrency:', concurrency)

let tests = process.argv
.filter((arg) => arg.match(/\.test\.(js|ts|tsx)/))
.concat(externalTestsFilterLists)
let tests = process.argv.filter((arg) => arg.match(/\.test\.(js|ts|tsx)/))
let prevTimings

if (tests.length === 0) {
Expand Down Expand Up @@ -190,6 +188,16 @@ async function main() {
}
}

// If there are external manifest contains list of tests, apply it to the test lists
// Currently, we expect manifest should include named export to the array `disabledTests`,
// which we'll explicitly filter out from the test list.
console.log('pppp', tests.length)
tests = tests.filter(
(test) => !externalTestsFilterLists.disabledTests.includes(test)
)
console.log('a', externalTestsFilterLists.disabledTests.length)
console.log('pppp2', tests.length)

let testNames = [
...new Set(
tests.map((f) => {
Expand Down

0 comments on commit 73cf952

Please sign in to comment.