Skip to content

Commit

Permalink
rc-config: Add before/after to describe block.
Browse files Browse the repository at this point in the history
Fixes the workspaces test failure on Node v20 on Github Actions.
  • Loading branch information
raineorshine committed Jun 24, 2023
1 parent 147b899 commit 63e564c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/package-managers/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ async function viewMany(
}

if (npmConfigProject && Object.keys(npmConfigProject).length > 0) {
print(options, `\npm config (project: ${npmConfigProjectPath}):`, 'verbose')
print(options, `\nnpm config (project: ${npmConfigProjectPath}):`, 'verbose')
print(options, omit(npmConfigProject, 'cache'), 'verbose')
}

Expand Down
9 changes: 5 additions & 4 deletions test/rc-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ process.env.NCU_TESTS = 'true'

const bin = path.join(__dirname, '../build/src/bin/cli.js')

let stub: { restore: () => void }
before(() => (stub = stubNpmView('99.9.9', { spawn: true })))
after(() => stub.restore())

describe('rc-config', () => {
// before/after must be placed within the describe block, otherwise they will apply to tests in other files
let stub: { restore: () => void }
before(() => (stub = stubNpmView('99.9.9', { spawn: true })))
after(() => stub.restore())

it('print rcConfigPath when there is a non-empty rc config file', async () => {
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'npm-check-updates-'))
const tempConfigFile = path.join(tempDir, '.ncurc.json')
Expand Down
2 changes: 1 addition & 1 deletion test/workspaces.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ describe('stubbed', () => {
})

describe('pnpm', () => {
it('read packages from pnpm-workspaces.yaml', async () => {
it('read packages from pnpm-workspace.yaml', async () => {
const tempDir = await setup(['packages/**'], { pnpm: true })
try {
const output = await spawn('node', [bin, '--jsonAll', '--workspaces'], { cwd: tempDir }).then(JSON.parse)
Expand Down

0 comments on commit 63e564c

Please sign in to comment.