Skip to content
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

fix: correct import_map attribute name in validation #241

Merged
merged 5 commits into from
Dec 6, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions node/bundler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { useFixture } from '../test/util.js'
import { BundleError } from './bundle_error.js'
import { bundle, BundleOptions } from './bundler.js'
import { isNodeError } from './utils/error.js'
import { validateManifest } from './validation/manifest/index.js'

test('Produces an ESZIP bundle', async () => {
const { basePath, cleanup, distPath } = await useFixture('with_import_maps')
Expand All @@ -34,6 +35,7 @@ test('Produces an ESZIP bundle', async () => {

const manifestFile = await fs.readFile(resolve(distPath, 'manifest.json'), 'utf8')
const manifest = JSON.parse(manifestFile)
expect(() => validateManifest(manifest)).not.toThrowError()
const { bundles, import_map: importMapURL } = manifest

expect(bundles.length).toBe(1)
Expand Down
4 changes: 2 additions & 2 deletions node/validation/manifest/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ TYPE must be string

28 | ],
29 | \\"bundler_version\\": \\"1.6.0\\",
> 30 | \\"importMapURL\\": [
| ^
> 30 | \\"import_map\\": [
| ^
> 31 | \\"file:///root/.netlify/edge-functions-dist/import_map.json\\"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 32 | ]
Expand Down
4 changes: 2 additions & 2 deletions node/validation/manifest/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ describe('layers', () => {
describe('import map URL', () => {
test('should accept string value', () => {
const manifest = getBaseManifest()
manifest.importMapURL = 'file:///root/.netlify/edge-functions-dist/import_map.json'
manifest.import_map = 'file:///root/.netlify/edge-functions-dist/import_map.json'

expect(() => validateManifest(manifest)).not.toThrowError()
})

test('should throw on wrong type', () => {
const manifest = getBaseManifest()
manifest.importMapURL = ['file:///root/.netlify/edge-functions-dist/import_map.json']
manifest.import_map = ['file:///root/.netlify/edge-functions-dist/import_map.json']

expect(() => validateManifest(manifest)).toThrowErrorMatchingSnapshot()
})
Expand Down
2 changes: 1 addition & 1 deletion node/validation/manifest/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const edgeManifestSchema = {
type: 'array',
items: layersSchema,
},
importMapURL: { type: 'string' },
import_map: { type: 'string' },
bundler_version: { type: 'string' },
},
additionalProperties: false,
Expand Down