Update npm test script
Add a flatten option