Skip to content

Commit ca8ef54

Browse files
Copilotfregante
andcommitted
Drop build process, move tests next to source files
Co-authored-by: fregante <1402241+fregante@users.noreply.github.com>
1 parent 4f970f4 commit ca8ef54

File tree

9 files changed

+13
-55
lines changed

9 files changed

+13
-55
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
node_modules
22
npm-debug.log
3-
distribution
43
!test/fixtures/*/.DS_Store

.npmignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
test
2-
source
3-
build.js
2+
source/**/*.test.js

build.js

Lines changed: 0 additions & 37 deletions
This file was deleted.

package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,14 @@
2222
],
2323
"type": "module",
2424
"bin": {
25-
"chrome-webstore-upload": "distribution/cli.js"
25+
"chrome-webstore-upload": "source/cli.js"
2626
},
2727
"scripts": {
28-
"build": "node build.js",
29-
"pretest": "npm run build",
3028
"test": "xo && ava"
3129
},
3230
"xo": {
3331
"ignore": [
34-
"test/fixtures",
35-
"distribution",
36-
"build.js"
32+
"test/fixtures"
3733
],
3834
"rules": {
3935
"object-curly-spacing": [
@@ -45,6 +41,7 @@
4541
},
4642
"ava": {
4743
"files": [
44+
"source/**/*.test.js",
4845
"!test/fixtures/**",
4946
"!test/helpers/**"
5047
]

test/cli.js renamed to source/cli.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import test from 'ava';
22
import { execa } from 'execa';
3-
import { mockFileSystem } from './helpers/stubs.js';
3+
import { mockFileSystem } from '../test/helpers/stubs.js';
44

55
function env(vars = {}) {
66
return {
@@ -16,7 +16,7 @@ mockFileSystem();
1616

1717
test('Exits w/ message when param required by "Web Store Upload" is not provided', async t => {
1818
try {
19-
await execa('./distribution/cli.js', ['upload', '--source', 'test/fixtures/without-junk']);
19+
await execa('./source/cli.js', ['upload', '--source', 'test/fixtures/without-junk']);
2020
t.fail('Should have errored');
2121
} catch (error) {
2222
t.regex(error.message, /Option ".+" is required/);
@@ -25,7 +25,7 @@ test('Exits w/ message when param required by "Web Store Upload" is not provided
2525

2626
test('It should attempt to read ./manifest.json when the --source param is not provided', async t => {
2727
try {
28-
await execa('./distribution/cli.js', ['upload'], {
28+
await execa('./source/cli.js', ['upload'], {
2929
env: env(),
3030
});
3131
t.pass();

test/config.js renamed to source/config.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import process from 'node:process';
22
import test from 'ava';
3-
import createConfig from '../source/config.js';
4-
import { mockFileSystem } from './helpers/stubs.js';
3+
import { mockFileSystem } from '../test/helpers/stubs.js';
4+
import createConfig from './config.js';
55

66
mockFileSystem();
77

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import process from 'node:process';
22
import test from 'ava';
3-
import { stubConsoleLog } from './helpers/stubs.js';
3+
import { stubConsoleLog } from '../test/helpers/stubs.js';
44

55
test('CWSError displays message with ❌ prefix and helpful links', t => {
66
const logs = [];
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import path from 'node:path';
22
import test from 'ava';
33
import mockFs from 'mock-fs';
4-
import findSource from '../source/find-source.js';
5-
import { mockFileSystem } from './helpers/stubs.js';
4+
import { mockFileSystem } from '../test/helpers/stubs.js';
5+
import findSource from './find-source.js';
66

77
mockFileSystem();
88

test/util.js renamed to source/util.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import test from 'ava';
22
import { isArchive,
3-
isUploadSuccess } from '../source/util.js';
3+
isUploadSuccess } from './util.js';
44

55
test('isArchive', t => {
66
t.true(isArchive('extension.zip'));

0 commit comments

Comments
 (0)