Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
7038b623
Unverified
Commit
7038b623
authored
Jun 07, 2021
by
JJ Kasper
Committed by
GitHub
Jun 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix occasional test failures (#25855)
parent
5be354ed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
1 deletion
+58
-1
run-tests.js
run-tests.js
+57
-0
index.test.js
...tegration/rewrite-with-browser-history/test/index.test.js
+1
-1
No files found.
run-tests.js
View file @
7038b623
...
@@ -20,6 +20,8 @@ const UNIT_TEST_EXT = '.unit.test.js'
...
@@ -20,6 +20,8 @@ const UNIT_TEST_EXT = '.unit.test.js'
const
DEV_TEST_EXT
=
'.dev.test.js'
const
DEV_TEST_EXT
=
'.dev.test.js'
const
PROD_TEST_EXT
=
'.prod.test.js'
const
PROD_TEST_EXT
=
'.prod.test.js'
const
NON_CONCURRENT_TESTS
=
[
'test/integration/basic/test/index.test.js'
]
// which types we have configured to run separate
// which types we have configured to run separate
const
configuredTestTypes
=
[
UNIT_TEST_EXT
]
const
configuredTestTypes
=
[
UNIT_TEST_EXT
]
...
@@ -217,6 +219,61 @@ async function main() {
...
@@ -217,6 +219,61 @@ async function main() {
})
})
})
})
const
nonConcurrentTestNames
=
[]
testNames
=
testNames
.
filter
((
testName
)
=>
{
if
(
NON_CONCURRENT_TESTS
.
includes
(
testName
))
{
nonConcurrentTestNames
.
push
(
testName
)
return
false
}
return
true
})
// run non-concurrent test names separately and before
// concurrent ones
for
(
const
test
of
nonConcurrentTestNames
)
{
let
passed
=
false
for
(
let
i
=
0
;
i
<
NUM_RETRIES
+
1
;
i
++
)
{
try
{
const
time
=
await
runTest
(
test
,
i
>
0
)
timings
.
push
({
file
:
test
,
time
,
})
passed
=
true
break
}
catch
(
err
)
{
if
(
i
<
NUM_RETRIES
)
{
try
{
const
testDir
=
path
.
dirname
(
path
.
join
(
__dirname
,
test
))
console
.
log
(
'Cleaning test files at'
,
testDir
)
await
exec
(
`git clean -fdx "
${
testDir
}
"`
)
await
exec
(
`git checkout "
${
testDir
}
"`
)
}
catch
(
err
)
{}
}
}
}
if
(
!
passed
)
{
console
.
error
(
`
${
test
}
failed to pass within
${
NUM_RETRIES
}
retries`
)
children
.
forEach
((
child
)
=>
child
.
kill
())
if
(
isTestJob
)
{
try
{
const
testsOutput
=
await
fs
.
readFile
(
`
${
test
}${
RESULTS_EXT
}
`
,
'utf8'
)
console
.
log
(
`--test output start--`
,
testsOutput
,
`--test output end--`
)
}
catch
(
err
)
{
console
.
log
(
`Failed to load test output`
,
err
)
}
}
process
.
exit
(
1
)
}
}
await
Promise
.
all
(
await
Promise
.
all
(
testNames
.
map
(
async
(
test
)
=>
{
testNames
.
map
(
async
(
test
)
=>
{
await
sema
.
acquire
()
await
sema
.
acquire
()
...
...
test/integration/rewrite-with-browser-history/test/index.test.js
View file @
7038b623
...
@@ -30,7 +30,7 @@ const runTests = () => {
...
@@ -30,7 +30,7 @@ const runTests = () => {
.
click
()
.
click
()
.
waitForElementByCss
(
'#index'
)
.
waitForElementByCss
(
'#index'
)
await
browser
.
back
()
await
browser
.
back
()
.
waitForElementByCss
(
'#another'
)
expect
(
await
browser
.
elementByCss
(
'#another'
).
text
()).
toBe
(
'another page'
)
expect
(
await
browser
.
elementByCss
(
'#another'
).
text
()).
toBe
(
'another page'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment