Skip to content

Commit

Permalink
add a test to verify the CommonJS build
Browse files Browse the repository at this point in the history
  • Loading branch information
75lb committed Jul 18, 2024
1 parent 2a6e157 commit ef39f3a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"scripts": {
"test": "npm run dist && npm run test:ci",
"test:ci": "test-runner 'test/**/*.js'",
"test:ci": "test-runner 'test/**/*.js' 'test/**/*.cjs'",
"docs": "jsdoc2md index.js -p list --member-index-format list > docs/API.md",
"dist": "rollup -c"
},
Expand Down
24 changes: 24 additions & 0 deletions test/common-js.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const Tom = require('@test-runner/tom')
const Table = require('table-layout')
const assert = require('assert')
const a = assert.strict

const eol = '\n'
const tom = new Tom()

tom.test('new Table()', function () {
const options = {
maxWidth: 40,
padding: { left: '<', right: '>' }
}
const data = [
{ one: 'row 1 column one .. .. ..', two: 'r1 c2' },
{ one: 'r2 c1', two: 'row two column 2' }
]
const table = new Table(data, options)

a.equal(table.rows.list.length, 2)
a.equal(table.columns.list.length, 2)
})

module.exports = tom

0 comments on commit ef39f3a

Please sign in to comment.