-
Notifications
You must be signed in to change notification settings - Fork 675
build: use node test runner for workspace packages #2529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9b2de8f
c02a6ff
bbaafab
9b0924c
f8f538b
6aef281
72a5125
80d53c7
acb2c2b
5a15a5a
0db8c83
6e161be
e1ea765
da55234
a06bca8
f870dad
51c25b8
33e1a01
a9f4fce
2c2d297
858336a
3a5535e
c3d1f1a
25f2815
55cf42e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@slack/oauth": patch | ||
| --- | ||
|
|
||
| fix: write files to the file installation store using the path.join method |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,3 @@ | ||
| # Node and NPM stuff | ||
| /node_modules | ||
| package-lock.json | ||
|
|
||
| # Coverage carryover | ||
| /coverage |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,9 @@ | ||
| import assert from 'node:assert'; | ||
| import childProcess from 'node:child_process'; | ||
| import fs from 'node:fs'; | ||
| import os from 'node:os'; | ||
| import path from 'node:path'; | ||
| import util from 'node:util'; | ||
| import { after, before, describe, it } from 'mocha'; | ||
| import { after, before, describe, it } from 'node:test'; | ||
| import sinon from 'sinon'; | ||
|
|
||
| import checkForSDKUpdates, { | ||
|
|
@@ -47,34 +48,23 @@ function mockNPM(command) { | |
|
|
||
| describe('check-update implementation', async () => { | ||
| describe('collects recent package versions', async () => { | ||
| const tempDir = path.join(process.cwd(), 'tmp'); | ||
| const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'check-update-')); | ||
|
Comment on lines
-50
to
+51
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👁️🗨️ note: Here we're avoiding a stalemate when multiple tests run at the same time. Now we instead use separate |
||
| const packageJSONFilePath = path.join(tempDir, 'package.json'); | ||
|
|
||
| before(() => { | ||
| sinon.stub(util, 'promisify').returns((/** @type {string} */ command) => { | ||
| const info = mockNPM(command); | ||
| return Promise.resolve({ stdout: info }); | ||
| sinon.stub(childProcess, 'exec').callsFake((command, cb) => { | ||
| cb(null, { stdout: mockNPM(command), stderr: '' }); | ||
| }); | ||
|
Comment on lines
+55
to
57
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📺 note: We stub the |
||
| if (!fs.existsSync(tempDir)) { | ||
| fs.mkdirSync(tempDir); | ||
| } | ||
| if (!fs.existsSync(packageJSONFilePath)) { | ||
| fs.writeFileSync(packageJSONFilePath, JSON.stringify(packageJSON, null, 2)); | ||
| } | ||
| fs.writeFileSync(packageJSONFilePath, JSON.stringify(packageJSON, null, 2)); | ||
| }); | ||
|
|
||
| after(() => { | ||
| sinon.restore(); | ||
| if (fs.existsSync(packageJSONFilePath)) { | ||
| fs.unlinkSync(packageJSONFilePath); | ||
| } | ||
| if (fs.existsSync(tempDir)) { | ||
| fs.rmSync(tempDir, { recursive: true }); | ||
| } | ||
| fs.rmSync(tempDir, { recursive: true, force: true }); | ||
| }); | ||
|
|
||
| it('shows version information for packages', async () => { | ||
| const updates = await checkForSDKUpdates('./tmp'); | ||
| const updates = await checkForSDKUpdates(tempDir); | ||
| const expected = { | ||
| name: 'the Slack SDK', | ||
| error: undefined, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤩