Closed gwh-cpnet closed 4 years ago
TBD: 0.1.0
TBD: Create a 777 folder
TBD: Created a 755 folder
import fs from 'fs'; import tmp from 'tmp'; import assert from 'assert'; import tmpPromise from 'tmp-promise'; describe('tmp-promise', () => { it('should create a 0o777 tmp dir', async () => { const tmpDir = await tmpPromise.dir({ mode: 0o777 }); const { mode } = await fs.promises.stat(tmpDir.path); assert.equal(mode & 0o777, 0o777); // eslint-disable-line no-bitwise tmpDir.cleanup(); }); }); describe('tmp', () => { it('should create a 0o777 tmp dir', () => { const tmpDir = tmp.dirSync({ mode: 0o777 }); const { mode } = fs.statSync(tmpDir.name); assert.equal(mode & 0o777, 0o777); // eslint-disable-line no-bitwise tmpDir.removeCallback(); }); });
result:
1) tmp-promise AssertionError [ERR_ASSERTION]: 493 == 511 2) tmp AssertionError [ERR_ASSERTION]: 493 == 511
okay, it turns out to be a node and linux issue.
https://github.com/nodejs/node/issues/15092#issuecomment-325994747
Operating System
NodeJS Version
Tmp Version
TBD: 0.1.0
Expected Behavior
TBD: Create a 777 folder
Experienced Behavior
TBD: Created a 755 folder
result: