Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adjust tests according to heapprofiler typo fix #403

Merged
merged 1 commit into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions test/cli-heapprofiler-full.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test('clinic heapprofiler -- node - no issues', function (t) {
function (err, stdout, stderr, tempdir) {
t.error(err)

const dirname = stdout.match(/(\.clinic[/\\]\d+.clinic-heapprofile)/)[1]
const dirname = stdout.match(/(\.clinic[/\\]\d+.clinic-heapprofiler)/)[1]
const fullpath = url.pathToFileURL(fs.realpathSync(path.resolve(tempdir, dirname)))

t.equal(stdout.split('\n')[2], `Generated HTML file is ${fullpath}.html`)
Expand Down Expand Up @@ -46,7 +46,7 @@ test('clinic heapprofiler -- node - bad status code', function (t) {
['clinic', 'heapprofiler', '--no-open', '--', 'node', '-e', 'process.exitCode = 1'],
function (err, stdout, stderr, tempdir) {
t.error(err)
const dirname = stdout.match(/(\.clinic[/\\]\d+.clinic-heapprofile)/)[1]
const dirname = stdout.match(/(\.clinic[/\\]\d+.clinic-heapprofiler)/)[1]
const fullpath = url.pathToFileURL(fs.realpathSync(path.resolve(tempdir, dirname)))

t.equal(stdout.split('\n')[2], `Generated HTML file is ${fullpath}.html`)
Expand Down Expand Up @@ -86,7 +86,7 @@ test('clinic heapprofiler --on-port', function (t) {
function (err, stdout, stderr, tempdir) {
t.error(err)

const dirname = stdout.match(/(\.clinic[/\\]\d+.clinic-heapprofile)/)[1]
const dirname = stdout.match(/(\.clinic[/\\]\d+.clinic-heapprofiler)/)[1]
const fullpath = url.pathToFileURL(fs.realpathSync(path.resolve(tempdir, dirname)))

t.ok(stderr.indexOf('Running 2s test @ http://localhost:') > -1)
Expand Down Expand Up @@ -115,7 +115,7 @@ test('clinic heapprofiler --autocannon', function (t) {
function (err, stdout, stderr, tempdir) {
t.error(err)

const dirname = stdout.match(/(\.clinic[/\\]\d+.clinic-heapprofile)/)[1]
const dirname = stdout.match(/(\.clinic[/\\]\d+.clinic-heapprofiler)/)[1]
const fullpath = url.pathToFileURL(fs.realpathSync(path.resolve(tempdir, dirname)))

t.ok(stderr.indexOf('Running 10s test @ http://localhost:') > -1)
Expand All @@ -134,7 +134,7 @@ test('clinic heapprofiler -- node - configure output destination', function (t)
'heapprofiler',
'--no-open',
'--dest',
'test-heapprofiler-destination.clinic-heapprofile',
'test-heapprofiler-destination.clinic-heapprofiler',
'--',
'node',
'-e',
Expand All @@ -143,8 +143,8 @@ test('clinic heapprofiler -- node - configure output destination', function (t)
function (err, stdout, stderr, tempdir) {
t.error(err)

t.ok(fs.statSync(path.join(tempdir, 'test-heapprofiler-destination.clinic-heapprofile')).isFile())
t.ok(fs.statSync(path.join(tempdir, 'test-heapprofiler-destination.clinic-heapprofile.html')).isFile())
t.ok(fs.statSync(path.join(tempdir, 'test-heapprofiler-destination.clinic-heapprofiler')).isFile())
t.ok(fs.statSync(path.join(tempdir, 'test-heapprofiler-destination.clinic-heapprofiler.html')).isFile())
t.end()
}
)
Expand Down
2 changes: 1 addition & 1 deletion test/cli-heapprofiler-non-node.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test('clinic heapprofiler - should accept full path to node.js', function (t) {
['clinic', 'heapprofiler', '--no-open', '--', process.execPath, '-e', 'setTimeout(() => {}, 10)'],
function (err, stdout) {
t.error(err)
t.ok(/Generated HTML file is (.*?)\.clinic[/\\](\d+).clinic-heapprofile/.test(stdout))
t.ok(/Generated HTML file is (.*?)\.clinic[/\\](\d+).clinic-heapprofiler/.test(stdout))
t.end()
}
)
Expand Down
2 changes: 1 addition & 1 deletion test/cli-heapprofiler-stop-delay.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test('clinic heapprofiler --stop-delay --on-port - no issues', function (t) {
], function (err, stdout, stderr, tempdir) {
t.error(err)

const dirname = stdout.match(/(\.clinic[/\\]\d+.clinic-heapprofile)/)[1]
const dirname = stdout.match(/(\.clinic[/\\]\d+.clinic-heapprofiler)/)[1]
const fullpath = url.pathToFileURL(fs.realpathSync(path.resolve(tempdir, dirname)))
t.equal(stdout.split('\n')[0], 'Waiting to close the process')
t.equal(stdout.split('\n')[1], 'Analysing data')
Expand Down
10 changes: 5 additions & 5 deletions test/cli-heapprofiler-visualize-only.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ test('clinic heapprofiler --visualize-only - no issues', function (t) {
['clinic', 'heapprofiler', '--collect-only', '--', 'node', '-e', 'require("util").inspect(process)'],
function (err, stdout, stderr, tempdir) {
t.error(err)
t.ok(/Output file is \.clinic[/\\](\d+).clinic-heapprofile/.test(stdout))
t.ok(/Output file is \.clinic[/\\](\d+).clinic-heapprofiler/.test(stdout))

const dirname = stdout.match(/(\.clinic[/\\]\d+.clinic-heapprofile)/)[1]
const dirname = stdout.match(/(\.clinic[/\\]\d+.clinic-heapprofiler)/)[1]
const dirpath = path.resolve(tempdir, dirname)

// visualize data
Expand All @@ -34,7 +34,7 @@ test('clinic heapprofiler --visualize-only - no issues', function (t) {
})

test('clinic heapprofiler --visualize-only - missing data', function (t) {
const arg = 'missing.clinic-heapprofile'
const arg = 'missing.clinic-heapprofiler'
cli({ relayStderr: false }, ['clinic', 'heapprofiler', '--visualize-only', arg], function (err, stdout, stderr) {
t.strictSame(err, new Error('process exited with exit code 1'))
t.equal(stdout, '')
Expand All @@ -50,8 +50,8 @@ test('clinic heapprofiler --visualize-only - supports trailing slash', function
['clinic', 'heapprofiler', '--collect-only', '--', 'node', '-e', 'require("util").inspect(process)'],
function (err, stdout, stderr, tempdir) {
t.error(err)
t.ok(/Output file is \.clinic[/\\](\d+).clinic-heapprofile/.test(stdout))
const filename = stdout.match(/(\.clinic[/\\]\d+.clinic-heapprofile)/)[1]
t.ok(/Output file is \.clinic[/\\](\d+).clinic-heapprofiler/.test(stdout))
const filename = stdout.match(/(\.clinic[/\\]\d+.clinic-heapprofiler)/)[1]
const dirpath = path.resolve(tempdir, filename)

// visualize data
Expand Down