Skip to content

Commit

Permalink
test: cover negative overrides being used
Browse files Browse the repository at this point in the history
  • Loading branch information
naugtur committed Jun 3, 2022
1 parent 30590c4 commit c90e197
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions packages/core/test/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,37 @@ test('globals - explicitly disallowing properties on the globalThis', async (t)
await t.throwsAsync(runScenario({ scenario }), { message: 'globalThis.abc is not a function' })
})

test('globals - explicitly disallowing properties on the globalThis via overrides', async (t) => {
'use strict'
const scenario = createScenarioFromScaffold({
defineOne: () => {
module.exports = globalThis.abc()
},
context: {
abc: function () { return 42 }
},
config: {
resources: {
one: {
globals: {
'abc': true
}
}
}
},
configOverride: {
resources: {
one: {
globals: {
'abc': false
}
}
}
}
})
await t.throwsAsync(runScenario({ scenario }), { message: 'globalThis.abc is not a function' })
})

test.failing('globals - nested poperty allow/disallow', async (t) => {
'use strict'
const shared = {
Expand Down

0 comments on commit c90e197

Please sign in to comment.