You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
message: 'Invalid import [importing `bar` from `entry.js`]',
101
+
})
102
+
expect(result.message).toMatchInlineSnapshot(`"[plugin impound] Invalid import [importing \`bar\` from \`entry.js\`]"`)
103
+
})
104
+
105
+
it('allows import when onViolation returns false',async()=>{
106
+
constresult=awaitprocess(code('bar'),{
107
+
patterns: [['bar']],
108
+
onViolation: ()=>false,
109
+
})
110
+
expect(result).toMatchInlineSnapshot(`
111
+
"var thing = "loaded";
112
+
113
+
console.log(thing);"
114
+
`)
115
+
})
116
+
94
117
it('provides a helpful error message when importing a disallowed pattern',async()=>{
95
118
constresult=awaitprocess(code('bar'),{patterns: [['bar','"bar" is a dangerous library and should never be used.']]})asRollupError
96
119
expect(result.message).toMatchInlineSnapshot(`"[plugin impound] "bar" is a dangerous library and should never be used. [importing \`bar\` from \`entry.js\`]"`)
0 commit comments