1
1
mirror of https://github.com/primer/css.git synced 2024-12-03 03:33:40 +03:00
css/__tests__/build.test.js
dependabot[bot] f27faef3eb
Bump globby from 11.0.4 to 12.0.0 (#1515)
* Bump globby from 11.0.4 to 12.0.0

Bumps [globby](https://github.com/sindresorhus/globby) from 11.0.4 to 12.0.0.
- [Release notes](https://github.com/sindresorhus/globby/releases)
- [Commits](https://github.com/sindresorhus/globby/compare/v11.0.4...v12.0.0)

---
updated-dependencies:
- dependency-name: globby
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Import globby

* Converting tests

* Ignore docs test

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jon Rohan <yes@jonrohan.codes>
2021-08-11 17:11:35 -07:00

58 lines
1.2 KiB
JavaScript

import fs from 'fs'
let distDir
beforeAll(() => {
distDir = fs.readdirSync('./dist')
})
describe('./dist/ folder', () => {
let distCSS, distMap, distJS
beforeAll(() => {
distCSS = distDir.filter(i => i.match(/\.css$/))
distMap = distDir.filter(i => i.match(/\.map$/))
distJS = distDir.filter(i => i.match(/\.js$/))
})
it('is not empty', () => {
expect(distDir).not.toBeNull()
expect(distDir.length).not.toBe(0)
})
it('contains source maps', () => {
for (const file of distCSS) {
expect(distMap).toContain(`${file}.map`)
}
})
it('contains stats export files', () => {
for (const file of distCSS) {
expect(distJS).toContain(file.replace('.css', '.js'))
}
})
it('contains stats/ folder', () => {
expect(distDir).toContain('stats')
})
})
describe('./dist/stats/ folder', () => {
let statsDir
beforeAll(() => {
statsDir = fs.readdirSync('./dist/stats')
})
it('is not empty', () => {
expect(statsDir).not.toBeNull()
expect(statsDir.length).not.toBe(0)
})
it('contains a css file for each stat file', () => {
for (const file of statsDir) {
expect(distDir).toContain(file.replace('.json', '.css'))
}
})
})