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
8eba6007
Commit
8eba6007
authored
Sep 03, 2024
by
Janka Uryga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ci: fix mockSpan in next-stats-action and reuse it
parent
13cd9de2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
13 deletions
+19
-13
repo-setup.js
.github/actions/next-stats-action/src/prepare/repo-setup.js
+3
-6
mock-trace.js
.github/actions/next-stats-action/src/util/mock-trace.js
+14
-0
run-tests.js
run-tests.js
+2
-7
No files found.
.github/actions/next-stats-action/src/prepare/repo-setup.js
View file @
8eba6007
...
@@ -4,12 +4,9 @@ const { existsSync } = require('fs')
...
@@ -4,12 +4,9 @@ const { existsSync } = require('fs')
const
exec
=
require
(
'../util/exec'
)
const
exec
=
require
(
'../util/exec'
)
const
logger
=
require
(
'../util/logger'
)
const
logger
=
require
(
'../util/logger'
)
const
execa
=
require
(
'execa'
)
const
execa
=
require
(
'execa'
)
const
mockSpan
=
require
(
'../util/mock-trace'
)
const
mockSpan
=
()
=>
({
/** @typedef {import('../util/mock-trace').Span} Span */
traceAsyncFn
:
(
fn
)
=>
fn
(
mockTrace
()),
traceFn
:
(
fn
)
=>
fn
(
mockTrace
()),
traceChild
:
()
=>
mockTrace
(),
})
module
.
exports
=
(
actionInfo
)
=>
{
module
.
exports
=
(
actionInfo
)
=>
{
return
{
return
{
...
@@ -62,7 +59,7 @@ module.exports = (actionInfo) => {
...
@@ -62,7 +59,7 @@ module.exports = (actionInfo) => {
},
},
/**
/**
* Runs `pnpm pack` on each package in the `packages` folder of the provided `repoDir`
* Runs `pnpm pack` on each package in the `packages` folder of the provided `repoDir`
* @param {{ repoDir: string, nextSwcVersion: null | string }} options Required options
* @param {{ repoDir: string, nextSwcVersion: null | string
, parentSpan?: Span
}} options Required options
* @returns {Promise<Map<string, string>>} List packages key is the package name, value is the path to the packed tar file.'
* @returns {Promise<Map<string, string>>} List packages key is the package name, value is the path to the packed tar file.'
*/
*/
async
linkPackages
({
repoDir
,
nextSwcVersion
,
parentSpan
})
{
async
linkPackages
({
repoDir
,
nextSwcVersion
,
parentSpan
})
{
...
...
.github/actions/next-stats-action/src/util/mock-trace.js
0 → 100644
View file @
8eba6007
/** @returns {Span} */
const
createMockSpan
=
()
=>
({
traceAsyncFn
:
(
fn
)
=>
fn
(
createMockSpan
()),
traceFn
:
(
fn
)
=>
fn
(
createMockSpan
()),
traceChild
:
()
=>
createMockSpan
(),
})
/** @typedef {{
* traceAsyncFn: <T>(fn: (span: Span) => Promise<T>) => Promise<T>,
* traceFn: <T>(fn: (span: Span) => T) => T,
* traceChild: (id: string, data?: Record<string, any>) => Span,
* }} Span */
module
.
exports
=
createMockSpan
run-tests.js
View file @
8eba6007
...
@@ -14,6 +14,7 @@ const glob = promisify(_glob)
...
@@ -14,6 +14,7 @@ const glob = promisify(_glob)
const
exec
=
promisify
(
execOrig
)
const
exec
=
promisify
(
execOrig
)
const
core
=
require
(
'@actions/core'
)
const
core
=
require
(
'@actions/core'
)
const
{
getTestFilter
}
=
require
(
'./test/get-test-filter'
)
const
{
getTestFilter
}
=
require
(
'./test/get-test-filter'
)
const
mockSpan
=
require
(
'./.github/actions/next-stats-action/src/util/mock-trace'
)
let
argv
=
require
(
'yargs/yargs'
)(
process
.
argv
.
slice
(
2
))
let
argv
=
require
(
'yargs/yargs'
)(
process
.
argv
.
slice
(
2
))
.
string
(
'type'
)
.
string
(
'type'
)
...
@@ -78,12 +79,6 @@ const testFilters = {
...
@@ -78,12 +79,6 @@ const testFilters = {
e2e
:
'test/e2e/'
,
e2e
:
'test/e2e/'
,
}
}
const
mockTrace
=
()
=>
({
traceAsyncFn
:
(
fn
)
=>
fn
(
mockTrace
()),
traceFn
:
(
fn
)
=>
fn
(
mockTrace
()),
traceChild
:
()
=>
mockTrace
(),
})
// which types we have configured to run separate
// which types we have configured to run separate
const
configuredTestTypes
=
Object
.
values
(
testFilters
)
const
configuredTestTypes
=
Object
.
values
(
testFilters
)
const
errorsPerTests
=
new
Map
()
const
errorsPerTests
=
new
Map
()
...
@@ -388,7 +383,7 @@ ${ENDGROUP}`)
...
@@ -388,7 +383,7 @@ ${ENDGROUP}`)
console
.
log
(
`
${
GROUP
}
Creating Next.js install for isolated tests`
)
console
.
log
(
`
${
GROUP
}
Creating Next.js install for isolated tests`
)
const
reactVersion
=
process
.
env
.
NEXT_TEST_REACT_VERSION
||
'latest'
const
reactVersion
=
process
.
env
.
NEXT_TEST_REACT_VERSION
||
'latest'
const
{
installDir
,
pkgPaths
,
tmpRepoDir
}
=
await
createNextInstall
({
const
{
installDir
,
pkgPaths
,
tmpRepoDir
}
=
await
createNextInstall
({
parentSpan
:
mock
Trace
(),
parentSpan
:
mock
Span
(),
dependencies
:
{
dependencies
:
{
react
:
reactVersion
,
react
:
reactVersion
,
'react-dom'
:
reactVersion
,
'react-dom'
:
reactVersion
,
...
...
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