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

JSON updates #768

Merged
merged 4 commits into from
Mar 11, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Test from main entry point
  • Loading branch information
RyanZim committed Mar 10, 2020
commit 9a52356ea7fbcd704c5a5ee2c591199209a4e7b2
5 changes: 2 additions & 3 deletions lib/json/__tests__/output-json-sync.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const os = require('os')
const fse = require(process.cwd())
const path = require('path')
const assert = require('assert')
const outputJsonSync = require('../output-json-sync')

/* global beforeEach, describe, it */

Expand All @@ -23,7 +22,7 @@ describe('json', () => {
assert(!fs.existsSync(file))

const data = { name: 'JP' }
outputJsonSync(file, data)
fse.outputJsonSync(file, data)

assert(fs.existsSync(file))
const newData = JSON.parse(fs.readFileSync(file, 'utf8'))
Expand All @@ -39,7 +38,7 @@ describe('json', () => {
const replacer = (k, v) => v === 'JP' ? 'Jon Paul' : v
const data = { name: 'JP' }

outputJsonSync(file, data, { replacer })
fse.outputJsonSync(file, data, { replacer })
const newData = JSON.parse(fs.readFileSync(file, 'utf8'))

assert.strictEqual(newData.name, 'Jon Paul')
Expand Down
7 changes: 3 additions & 4 deletions lib/json/__tests__/output-json.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const os = require('os')
const fse = require(process.cwd())
const path = require('path')
const assert = require('assert')
const outputJson = require('../output-json')

/* global beforeEach, describe, it */

Expand All @@ -23,7 +22,7 @@ describe('json', () => {
assert(!fs.existsSync(file))

const data = { name: 'JP' }
outputJson(file, data, err => {
fse.outputJson(file, data, err => {
if (err) return done(err)

assert(fs.existsSync(file))
Expand All @@ -39,7 +38,7 @@ describe('json', () => {
assert(!fs.existsSync(file))

const data = { name: 'JP' }
return outputJson(file, data)
return fse.outputJson(file, data)
})

describe('> when an option is passed, like JSON replacer', () => {
Expand All @@ -50,7 +49,7 @@ describe('json', () => {
const replacer = (k, v) => v === 'JP' ? 'Jon Paul' : v
const data = { name: 'JP' }

outputJson(file, data, { replacer }, err => {
fse.outputJson(file, data, { replacer }, err => {
assert.ifError(err)
const newData = JSON.parse(fs.readFileSync(file, 'utf8'))
assert.strictEqual(newData.name, 'Jon Paul')
Expand Down