-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6dd0630
commit 6909204
Showing
8 changed files
with
49 additions
and
26 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,57 @@ | ||
const { verify, prepare, publish, success, fail } = require('./index'); | ||
import { mkdtemp, rmdir } from 'fs/promises'; | ||
import { addChannel, prepare, publish, verifyConditions } from './index.js'; | ||
import * as underlyingPlugin from '@semantic-release/npm'; | ||
|
||
const pluginConfig = { registries: { github: {}, public: {} } }; | ||
let workingDirectory; | ||
|
||
describe('verify', () => { | ||
beforeAll(async () => { | ||
workingDirectory = await mkdtemp('.'); | ||
}); | ||
|
||
afterAll(async () => { | ||
await rmdir(workingDirectory, { recursive: true }); | ||
}); | ||
|
||
const createPluginConfig = () => ({ | ||
registries: { github: {}, public: {} }, | ||
npmPublish: false, | ||
}); | ||
|
||
const createContext = () => ({ | ||
logger: console, | ||
env: {}, | ||
nextRelease: { version: '1.0' }, | ||
cwd: workingDirectory, | ||
}); | ||
|
||
describe('addChannel', () => { | ||
it('does not crash', async () => { | ||
await verify(pluginConfig, {}); | ||
await addChannel(createPluginConfig, createContext); | ||
}); | ||
}); | ||
|
||
describe('prepare', () => { | ||
it('does not crash', async () => { | ||
await prepare(pluginConfig, {}); | ||
describe('underlying plugin endpoints', () => { | ||
it('has the expected set of keys', () => { | ||
expect(new Set(Object.keys(underlyingPlugin))).toEqual( | ||
new Set(['addChannel', 'prepare', 'publish', 'verifyConditions']), | ||
); | ||
}); | ||
}); | ||
|
||
// We skip this one because it's not worth | ||
// setting up sufficient scaffolding to actually | ||
// try publishing a package. | ||
describe.skip('publish', () => { | ||
describe('prepare', () => { | ||
it('does not crash', async () => { | ||
await publish(pluginConfig, {}); | ||
await prepare(createPluginConfig, createContext); | ||
}); | ||
}); | ||
|
||
describe('success', () => { | ||
describe('publish', () => { | ||
it('does not crash', async () => { | ||
await success(pluginConfig, {}); | ||
await publish(createPluginConfig, createContext); | ||
}); | ||
}); | ||
|
||
describe('fail', () => { | ||
describe('verifyConditions', () => { | ||
it('does not crash', async () => { | ||
await fail(pluginConfig, {}); | ||
await verifyConditions(createPluginConfig, createContext); | ||
}); | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
"repository": "https://github.com/amanda-mitchell/semantic-release-npm-multiple", | ||
"author": "Amanda Mitchell <[email protected]>", | ||
"license": "MIT", | ||
"type": "module", | ||
"files": [ | ||
"index.js" | ||
], | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters