Skip to content

Commit 1464adc

Browse files
committed
chore: scope test fixture package names
1 parent 79cb556 commit 1464adc

3 files changed

Lines changed: 11 additions & 130 deletions

File tree

tap-snapshots/test/index.js.test.cjs

Lines changed: 3 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -27,137 +27,18 @@ exports[`test/index.js TAP load create:true existing parseable package.json > pa
2727
`
2828

2929
exports[`test/index.js TAP load custom formatting > should save back custom format to package.json 1`] = `
30-
{"name":"foo","version":"1.0.1","description":"Lorem ipsum dolor"}
30+
{"name":"@npmcli/test","version":"1.0.1","description":"Lorem ipsum dolor"}
3131
`
3232

3333
exports[`test/index.js TAP load read, update content and write > should properly save content to a package.json 1`] = `
3434
{
35-
"name": "foo",
35+
"name": "@npmcli/test",
3636
"version": "1.0.1",
3737
"description": "Lorem ipsum dolor"
3838
}
3939
4040
`
4141

42-
exports[`test/index.js TAP load sorts on save > should properly save content to a package.json 1`] = `
43-
{
44-
"name": "foo",
45-
"version": "1.0.0",
46-
"description": "A sample package",
47-
"keywords": [
48-
"sample",
49-
"package"
50-
],
51-
"homepage": "https://example.com",
52-
"bugs": {
53-
"url": "https://example.com/bugs",
54-
"email": "[email protected]"
55-
},
56-
"repository": {
57-
"type": "git",
58-
"url": "https://example.com/repo.git"
59-
},
60-
"funding": "https://example.com/funding",
61-
"license": "MIT",
62-
"author": "Author Name <[email protected]>",
63-
"maintainers": [
64-
"Maintainer One <[email protected]>",
65-
"Maintainer Two <[email protected]>"
66-
],
67-
"contributors": [
68-
"Contributor One <[email protected]>",
69-
"Contributor Two <[email protected]>"
70-
],
71-
"type": "module",
72-
"imports": {
73-
"#dep": "./src/dep.js"
74-
},
75-
"exports": {
76-
".": "./src/index.js"
77-
},
78-
"main": "index.js",
79-
"browser": "browser.js",
80-
"types": "index.d.ts",
81-
"bin": {
82-
"my-cli": "./bin/cli.js"
83-
},
84-
"man": [
85-
"./man/doc.1"
86-
],
87-
"directories": {
88-
"lib": "lib",
89-
"bin": "bin",
90-
"man": "man"
91-
},
92-
"files": [
93-
"lib/**/*.js",
94-
"bin/**/*.js"
95-
],
96-
"workspaces": [
97-
"packages/*"
98-
],
99-
"scripts": {
100-
"start": "node index.js",
101-
"test": "tap test/*.js"
102-
},
103-
"config": {
104-
"port": "8080"
105-
},
106-
"dependencies": {
107-
"some-dependency": "^1.0.0"
108-
},
109-
"devDependencies": {
110-
"some-dev-dependency": "^1.0.0"
111-
},
112-
"peerDependencies": {
113-
"some-peer-dependency": "^1.0.0"
114-
},
115-
"peerDependenciesMeta": {
116-
"some-peer-dependency": {
117-
"optional": true
118-
}
119-
},
120-
"optionalDependencies": {
121-
"some-optional-dependency": "^1.0.0"
122-
},
123-
"bundledDependencies": [
124-
"some-bundled-dependency"
125-
],
126-
"bundleDependencies": [
127-
"some-bundled-dependency"
128-
],
129-
"engines": {
130-
"node": ">=14.0.0"
131-
},
132-
"os": [
133-
"darwin",
134-
"linux"
135-
],
136-
"cpu": [
137-
"x64",
138-
"arm64"
139-
],
140-
"publishConfig": {
141-
"registry": "https://registry.example.com"
142-
},
143-
"devEngines": {
144-
"node": ">=14.0.0"
145-
},
146-
"licenses": [
147-
{
148-
"type": "MIT",
149-
"url": "https://opensource.org/licenses/MIT"
150-
}
151-
],
152-
"overrides": {
153-
"some-dependency": {
154-
"some-sub-dependency": "1.0.0"
155-
}
156-
}
157-
}
158-
159-
`
160-
16142
exports[`test/index.js TAP load update long package.json > should only update the defined property 1`] = `
16243
{
16344
"version": "7.18.1",
@@ -649,7 +530,7 @@ exports[`test/index.js TAP load update long package.json > should properly write
649530

650531
exports[`test/index.js TAP read package > must match snapshot 1`] = `
651532
Object {
652-
"name": "foo",
533+
"name": "@npmcli/test",
653534
"version": "1.0.0",
654535
}
655536
`

test/fixtures/all-fields-populated/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "foo",
2+
"name": "@npmcli/test",
33
"version": "1.0.0",
44
"private": true,
55
"description": "A sample package",
@@ -93,4 +93,4 @@
9393
"some-sub-dependency": "1.0.0"
9494
}
9595
}
96-
}
96+
}

test/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@ t.test('load', t => {
2222
t.test('read a valid package.json', async t => {
2323
const path = t.testdir({
2424
'package.json': JSON.stringify({
25-
name: 'foo',
25+
name: '@npmcli/test',
2626
version: '1.0.0',
2727
}),
2828
})
2929

3030
const pj = await PackageJson.load(path)
3131
t.same(
3232
pj.content,
33-
{ name: 'foo', version: '1.0.0' },
33+
{ name: '@npmcli/test', version: '1.0.0' },
3434
'should return content for a valid package.json'
3535
)
3636
})
3737
t.test('read, update content and write', async t => {
3838
const path = t.testdir({
3939
'package.json': JSON.stringify({
40-
name: 'foo',
40+
name: '@npmcli/test',
4141
version: '1.0.0',
4242
}, null, 8),
4343
})
@@ -65,7 +65,7 @@ t.test('load', t => {
6565
)
6666
})
6767
t.test('do not overwite unchanged file on EOF line added/removed', async t => {
68-
const originalPackageJsonContent = '{\n "name": "foo"\n}'
68+
const originalPackageJsonContent = '{\n "name": "@npmcli/test"\n}'
6969
const path = t.testdir({
7070
'package.json': originalPackageJsonContent,
7171
})
@@ -132,7 +132,7 @@ t.test('load', t => {
132132
t.test('custom formatting', async t => {
133133
const path = t.testdir({
134134
'package.json': JSON.stringify({
135-
name: 'foo',
135+
name: '@npmcli/test',
136136
version: '1.0.0',
137137
}, null, 0),
138138
})
@@ -243,7 +243,7 @@ t.test('read package', async t => {
243243
const { readPackage } = require('../lib/read-package')
244244
const path = t.testdir({
245245
'package.json': JSON.stringify({
246-
name: 'foo',
246+
name: '@npmcli/test',
247247
version: '1.0.0',
248248
}),
249249
})

0 commit comments

Comments
 (0)