Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/api/core/spec/slow/init.slow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ describe('init', () => {
fs.existsSync(path.resolve(dir, 'node_modules/@electron-forge/cli')),
).toEqual(true);
expect(fs.existsSync(path.join(dir, 'forge.config.js'))).toEqual(true);

// init should create a `private: true` npm package
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be a separate it('should create a "private: true" npm package')?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I refactored the tests a bit this week to make api.init part of the test instead of hiding it in a beforeEach() helper. I think this makes the Vitest output less descriptive but makes understanding the test flow easier.

const packageJSONString = await fs.promises.readFile(
path.join(dir, 'package.json'),
'utf-8',
);
const packageJSON = JSON.parse(packageJSONString);
expect(packageJSON).toHaveProperty('private', true);
});

describe('with electronVersion', () => {
Expand Down
1 change: 1 addition & 0 deletions packages/template/base/tmpl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"version": "1.0.0",
"description": "My Electron application description",
"main": "src/index.js",
"private": true,
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ describe('ViteTypeScriptTemplate', () => {
const jsFiles = await glob(path.join(dir, 'src', '**', '*.js'));
expect(jsFiles.length).toEqual(0);
});

it('should contain `private:true` in package.json', async () => {
const packageJSONString = await fs.promises.readFile(
path.join(dir, 'package.json'),
'utf-8',
);
const packageJSON = JSON.parse(packageJSONString);
expect(packageJSON).toHaveProperty('private', true);
});
});

describe('lint', () => {
Expand Down
9 changes: 9 additions & 0 deletions packages/template/vite/spec/ViteTemplate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,13 @@ describe('ViteTemplate', () => {
(await fs.promises.readFile(path.join(dir, 'index.html'))).toString(),
).toMatch(/src="\/src\/renderer\.js"/);
});

it('should contain `private:true` in package.json', async () => {
const packageJSONString = await fs.promises.readFile(
path.join(dir, 'package.json'),
'utf-8',
);
const packageJSON = JSON.parse(packageJSONString);
expect(packageJSON).toHaveProperty('private', true);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ describe('WebpackTypeScriptTemplate', () => {
expect(jsFiles.length).toEqual(0);
});

it('should contain `private:true` in package.json', async () => {
const packageJSONString = await fs.promises.readFile(
path.join(dir, 'package.json'),
'utf-8',
);
const packageJSON = JSON.parse(packageJSONString);
expect(packageJSON).toHaveProperty('private', true);
});

describe('lint', () => {
it('should initially pass the linting process', async () => {
delete process.env.TS_NODE_PROJECT;
Expand Down
9 changes: 9 additions & 0 deletions packages/template/webpack/spec/WebpackTemplate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,13 @@ describe('WebpackTemplate', () => {
).toString(),
).not.toMatch(/link rel="stylesheet"/);
});

it('should contain `private:true` in package.json', async () => {
const packageJSONString = await fs.promises.readFile(
path.join(dir, 'package.json'),
'utf-8',
);
const packageJSON = JSON.parse(packageJSONString);
expect(packageJSON).toHaveProperty('private', true);
});
});
Loading