Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
timfish committed Jun 12, 2024
1 parent 5e59d2a commit 262561b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/fixtures/json-attributes.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import coolFile from './something.json' with { type: 'json' }

export default {
data: coolFile.data
}
17 changes: 17 additions & 0 deletions test/hook/v18.19-static-import-attributes.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2.0 License.
//
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.

import jsonMjs from '../fixtures/json-attributes.mjs'
import { strictEqual } from 'assert'

// Acorn does not support import attributes so an error is logged but the import
// still works!
//
// Hook((exports, name) => {
// if (name.match(/json\.mjs/)) {
// exports.default.data += '-dawg'
// }
// })

strictEqual(jsonMjs.data, 'dog')

0 comments on commit 262561b

Please sign in to comment.