Skip to content

Commit

Permalink
dev: adds tests for plugin import resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
webketje committed Jun 27, 2023
1 parent f0f5135 commit 33889f0
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,40 @@ describe('@metalsmith/postcss', function () {
})
})

it('should do proper plugin imports', function (done) {
Metalsmith(fixture('use-absolute-paths'))
.use(
postcss({
plugins: { 'postcss-import': {}, autoprefixer: true }
})
)
.process((err) => {
try {
assert.strictEqual(err, null)
done()
} catch (err) {
done(err)
}
})
})

it('should throw when a plugin can not be imported', function (done) {
Metalsmith(fixture('use-absolute-paths'))
.use(
postcss({
plugins: ['postcss-import', 'autoprefixer', 'cssnano', 'inexistant']
})
)
.process((err) => {
try {
assert.strictEqual(err.code, 'ERR_MODULE_NOT_FOUND')
done()
} catch (err) {
done(err)
}
})
})

it('should support the PostCSS syntax options', function (done) {
const metalsmith = Metalsmith(fixture('scss-syntax'))
metalsmith
Expand Down

0 comments on commit 33889f0

Please sign in to comment.