Skip to content

Throws when data && file are null (an edge case) #776

@am11

Description

@am11

When an empty option set is sent to libsass, it chokes. :)
Same thing happens, when file and data options are empty or null.

//# this is 'node.js interactive console'

require("node-sass").renderSync({file:undefined})
// OR
require("node-sass").renderSync({file:null})
// OR
require("node-sass").renderSync({file:""})
// OR
require("node-sass").renderSync({data:undefined})
// OR
require("node-sass").renderSync({data:""})
// OR
require("node-sass").renderSync({data:"",file:""})
// OR
require("node-sass").renderSync({data:null,file:null})
// OR
require("node-sass").renderSync({data:undefined,file:undefined})
// OR permute undefined and null
// OR
require("node-sass").renderSync({})

// But this properly emits error:
require("node-sass").renderSync({file:"C:/temp/non-existing-path/blah.scss"})
/* returns:
{
  "status": 4,
  "message": "File to read not found or unreadable: C:/temp/non-existent-path/blah.scss"
}*/
// Also this is tolerable:
require("node-sass").renderSync({data:"messing around"})
/* returns:
{
  "status": 1,
  "file": "stdin",
  "line": 1,
  "column": 1,
  "message": "invalid top-level expression"
}*/
// And
require("node-sass").renderSync({data:null, file:"devnull"})
/* returns:
{
  "status": 4,
  "message": "File to read not found or unreadable: devnull"
}*/

Originally reported by @DinisCruz: sass/node-sass#554.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions